﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EmitMapper;

namespace Tools.Framework
{
    public class ObjectMapper
    {
        /// <summary>
        ///     实体映射
        /// </summary>
        /// <typeparam name="TForm">转换源对象 T</typeparam>
        /// <typeparam name="TTo">结果对象 T</typeparam>
        /// <param name="form">转换源对象</param>
        /// <returns>TTo </returns>
        public static TTo Mapper<TForm, TTo>(TForm form) where TForm : class
        {
            ObjectsMapper<TForm, TTo> mapper = ObjectMapperManager.DefaultInstance.GetMapper<TForm, TTo>();
            return mapper.Map(form);
        }
    }
}
